import React, { Component } from 'react'
import Header from '../../../components/header'
import axios from 'axios'
export default class Detail extends Component {
    state={
        list:[
            {
                orderId:null,
                entrySub:null,
                outputSub:null
            }
        ]
    }

   
    render() {
      
        const {list} = this.state
        return (
            <div>
                 <Header />
               
                {list[0].orderId}
                {list[0].entrySub}
                {list[0].outputSub}

            </div>
        )
    }
    componentDidMount(){

        console.log(this.props)

        // 第一种方式 通过loaction获取参数 id
        // let id = this.props.location.state.id;

        // 第二种方式 获取动态路由带来的参数

        let id = this.props.match.params.orderId;

        axios.post('/list/detail',{id}).then(res=>{
        
            this.setState({list:res.data.data})
        })
        
    }
    
}
